package com.usian.admin.job;

import com.usian.admin.feign.WemediaFeign;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private WemediaFeign wemediaFeign;
    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @XxlJob("wemediaAutoScanJob")
    public ReturnT<String> myJob(String param){
        //1.查询待发布列表  远程
        List<Integer> newsList = wemediaFeign.findNews();
        //2.遍历  去修改审核状态  8--9
        for (Integer newsId : newsList) {
            wemediaNewsAutoScanService.newAutoScan(newsId);
        }
        return  ReturnT.SUCCESS;
    }

}
